
using System.Text;

public class FileEncodingDetector
{
    public bool IsBinaryFile(string filePath)
    {
        using (var stream = File.OpenRead(filePath))
        {
            int ch;
            while ((ch = stream.ReadByte()) != -1)
            {
                if (ch > 0x7F) return true;
            }
        }
        return false;
    }

    public string ReadFileWithEncoding(string filePath)
    {
        if (IsBinaryFile(filePath))
        {
            Console.WriteLine($"Skipping binary file: {filePath}");
            return null;
        }

        return File.ReadAllText(filePath, Encoding.UTF8);
    }
} 